package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	import hall.common.IDGameHome;
	import hall.module.IDModuleApi;
	import ui.GameCamera;
	import ui.UIFade;
	
	/**
	 * ...
	 * @author lyf
	 */
	public class DGameHome extends Sprite implements IDGameHome
	{
		
		private var m_fade:UIFade = UIFade.self;
		private var m_timer:Timer = new Timer(1000 / 24);
		private var m_dManager:DHomeManager = null
		
		public function DGameHome():void 
		{
			this.stage.addEventListener(Event.RESIZE,onResize);
			init(null, null );
		}
		private function onResize( event:Event ):void {
			trace(this.m_fade.m_map.m_houseLayer.x, this.m_fade.m_map.m_houseLayer.y);
		}
		
		public function init(api:IDModuleApi, setting:XML):void 
		{
			stage.scaleMode = "noScale";
			GameCamera.self.setStage(stage);
			
			this.addChild(m_fade);
			
			m_dManager = new DHomeManager
			m_dManager.init(m_fade)
			
			m_timer.addEventListener(TimerEvent.TIMER, gameLoop);
			m_timer.start();
		}
		
		private function gameLoop( event:TimerEvent ):void {
			GameCamera.self.update();
		}
		
	}
	
}